package com.scuola;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class md5Class {

	public static String convertToMD5(String pass){
		try{
			MessageDigest md = MessageDigest.getInstance("MD5");
			byte[] messageDigest = md.digest(pass.getBytes());
			BigInteger number = new BigInteger(1,messageDigest);
			return number.toString(16);
		}catch(NoSuchAlgorithmException e){
			e.printStackTrace();
			return null;
		}
	}
}
